<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>散装油销售阈值设置</title>
    <script th:src="@{/layui1/layui.js}"></script>
    <link rel="stylesheet" th:href="@{/layui1/css/layui.css}">
</head>
<body>
<div class="layui-row" style="margin-top: 250px">
    <div class="layui-col-md6 layui-col-md-offset4">
        <form class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 170px">小型加油站销售阈值:</label>
                <div class="layui-input-inline">
                    <input type="text" id="minPSThreshold" name="minPSThreshold" required lay-verify="required" lay-reqtext="小型加油站销售阈值不能为空"
                           placeholder="请输入小型加油站销售阈值" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 170px">中型加油站销售阈值:</label>
                <div class="layui-input-inline">
                    <input type="text" id="middlePSThreshold" name="middlePSThreshold" required lay-verify="required" lay-reqtext="中型加油站销售阈值不能为空"
                           placeholder="请输入中型加油站销售阈值" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 170px">大型加油站销售阈值:</label>
                <div class="layui-input-inline">
                    <input type="text" id="maxPSThreshold" name="maxPSThreshold" required lay-verify="required" lay-reqtext="大型加油站销售阈值不能为空"
                           placeholder="请输入大型加油站销售阈值" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item" style="margin-left: 150px">
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="updateThresholdBtn">
                        <i class="layui-icon layui-icon-release"></i> 更改
                    </button>
                    <!--<input type="submit" value="提交更改" class="layui-btn layui-btn-primary layui-btn-radius">-->
                </div>
            </div>
        </form>
    </div>
</div>

</body>
<script>
    layui.use(['form','jquery','layer'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        var layer = layui.layer;
        //监听提交
        form.on('submit(updateThresholdBtn)',function(data){
            //console.log(data.field);
            $.ajax({
                url: '/petrolStationType/setThreshold',
                dataType: 'json',
                type: 'post',
                data: data.field,
                success: function (result) {
                    if (result.code==0) {
                        layer.msg('设置成功');
                    }else {
                        layer.msg('设置失败');
                    }
                }
            });
            return false;
        });

    });
</script>
</html>